#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int w[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char m[11] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};

bool check(string s)
{
    int num = 0;
    for(int i = 0; i < 17; i ++)
    {
        num = num + (s[i] - '0') * w[i];
    }
    num %= 11;
    if(s.back() == m[num])
    {
        return true;
    }
    return false;
}
int main()
{
    int n;
    bool flag = false;
    cin >> n;
    while(n --)
    {
        string s;
        cin >> s;
        if(!check(s)) 
        {
            flag = true;
            cout<< s << endl;
        }
    }
    if(!flag) cout << "All passed";
    return 0;
}